<?php
set_time_limit(0);
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
 
$dbhost = '47.110.131.55';
$dbuser = 'root';
$dbpwd  ='sxy7788123456';
$dbName ='race';
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);

$table='u3_yc';
if (isset($_GET['table'])){
    $table=$_GET['table'];
}
$arrLogTable=array(
    'u3_zz'=>'c3_log_zz',
    'u3_yc'=>'c3_log_yc',
    'u3_g3'=>'c3_log_g3',
    'u3_g2'=>'c3_log_g2',
    'u3_g1'=>'c3_log_g1',
    'u3_c3'=>'c3_log_c3',
    'u3_c2'=>'c3_log_c2',
    'u3_c1'=>'c3_log_c1'
);
$arrCTable=array(
    'u3_zz'=>'c3_zz',
    'u3_yc'=>'c3_yc',
    'u3_g3'=>'c3_g3',
    'u3_g2'=>'c3_g2',
    'u3_g1'=>'c3_g1',
    'u3_c3'=>'c3_c3',
    'u3_c2'=>'c3_c2',
    'u3_c1'=>'c3_c1'
);


$query=$mysqli->query("SELECT * FROM `".$table."` WHERE fen > 40 and miao < 25 order by id  ");
$logtable=$ctable='';

$logtable=$arrLogTable[$table];
$ctable=$arrCTable[$table];

if (empty($logtable) || empty($ctable)){
    echo 'empty $logtable';
    exit;
}
$ishas=false;
while ($list=$query->fetch_assoc()){
    $id=$list['id'];
    $miao=rand(260,500);
    $sql="update ".$table." set miao=".$miao." where id='".$list['id']."' ";
    echo $sql;
    echo "<br /><br />";
        
    $mysqli->query($sql);
     
    $ishas=true;

}

if ($ishas == true){
?>
<script> 
window.setTimeout(function(){
	//window.location.reload(); 
}, 300);
</script>
<?php } ?>
 
